package enterprises

import grails.test.*

class IndustrialSectorTests extends GrailsUnitTestCase {
	IndustrialSector sector
	
    protected void setUp() {
        super.setUp()
		sector = new IndustrialSector()
		sector.name = ""
		mockForConstraintsTests(IndustrialSector, [sector])
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testEmptyName() {
		assertFalse sector.validate()
		assertEquals "blank", sector.errors.name
    }
	
	void testSmallName() {
		sector.name = "as"
		assertFalse sector.validate()
		assertEquals "minSize", sector.errors.name
	}
	
	void testUniqueName() {
		mockDomain(IndustrialSector, [new IndustrialSector(name:"asd")])
		sector.name = "asd"
		assertFalse sector.validate()
		assertEquals "unique", sector.errors.name
	}
}
